#ifndef PORTLIST_H
#define PORTLIST_H
#include <QObject>
namespace Moolink {

    class PortList : public QObject
    {
        Q_OBJECT
        Q_PROPERTY(QStringList text READ text WRITE setText NOTIFY statusChanged)
    public:
        explicit PortList(QObject *parent = nullptr) : QObject(parent) {}

        Q_INVOKABLE int indexOf(QString portname){return m_text.indexOf(portname);}
        QStringList text() { return m_text; }

        void setText(QStringList text) {
            m_text.clear();
            m_text.append(text);
            emit statusChanged();
        }
        void append(QString text) {
            m_text.append(text);
            emit statusChanged();
        }

    signals:
        void statusChanged();

    private:
        QStringList m_text;
    };
}
#endif // PORTLIST_H
